UNPKG

@marko/translator-default

Version:
22 lines (19 loc) 821 B
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = _default;var _babelUtils = require("@marko/babel-utils"); var _vdomOutWrite = _interopRequireDefault(require("../util/vdom-out-write")); var _withPreviousLocation = _interopRequireDefault(require("../util/with-previous-location")); function _default(path) { const { node } = path; const { escape, value } = node; const method = escape ? "t" : "h"; const computed = (0, _babelUtils.computeNode)(value); if (computed && computed.value == null) { path.remove(); } else { path.replaceWith( (0, _withPreviousLocation.default)( (0, _vdomOutWrite.default)(method, value, path.hub.file._componentInstanceIdentifier), node ) ); } }